import 'package:aweb5/bean/aplus/somebody_official_plan_entity.dart';
import 'package:video_player/video_player.dart';

somebodyOfficialPlanEntityFromJson(SomebodyOfficialPlanEntity data, Map<String, dynamic> json) {
	if (json['msg'] != null) {
		data.msg = json['msg']?.toString();
	}
	if (json['data'] != null) {
		data.data = new SomebodyOfficialPlanData().fromJson(json['data']);
	}
	if (json['code'] != null) {
		data.code = json['code']?.toInt();
	}
	return data;
}

Map<String, dynamic> somebodyOfficialPlanEntityToJson(SomebodyOfficialPlanEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['msg'] = entity.msg;
	if (entity.data != null) {
		data['data'] = entity.data.toJson();
	}
	data['code'] = entity.code;
	return data;
}

somebodyOfficialPlanDataFromJson(SomebodyOfficialPlanData data, Map<String, dynamic> json) {
	if (json['send_task'] != null) {
		data.sendTask = new List<SomebodyOfficialPlanDataSendTask>();
		(json['send_task'] as List).forEach((v) {
			data.sendTask.add(new SomebodyOfficialPlanDataSendTask().fromJson(v));
		});
	}
	return data;
}

Map<String, dynamic> somebodyOfficialPlanDataToJson(SomebodyOfficialPlanData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	if (entity.sendTask != null) {
		data['send_task'] =  entity.sendTask.map((v) => v.toJson()).toList();
	}
	return data;
}

somebodyOfficialPlanDataSendTaskFromJson(SomebodyOfficialPlanDataSendTask data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id']?.toInt();
	}
	if (json['send_time'] != null) {
		data.sendTime = json['send_time']?.toString();
	}
	if (json['name'] != null) {
		data.name = json['name']?.toString();
	}
	if (json['is_send'] != null) {
		data.isSend = json['is_send']?.toInt();
	}
	if (json['task_id'] != null) {
		data.taskId = json['task_id']?.toInt();
	}
	if (json['info'] != null) {
		data.info = new List<SomebodyOfficialPlanDataSendTaskInfo>();
		(json['info'] as List).forEach((v) {
			data.info.add(new SomebodyOfficialPlanDataSendTaskInfo().fromJson(v));
		});
	}
	return data;
}

Map<String, dynamic> somebodyOfficialPlanDataSendTaskToJson(SomebodyOfficialPlanDataSendTask entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['send_time'] = entity.sendTime;
	data['name'] = entity.name;
	data['is_send'] = entity.isSend;
	data['task_id'] = entity.taskId;
	if (entity.info != null) {
		data['info'] =  entity.info.map((v) => v.toJson()).toList();
	}
	return data;
}

somebodyOfficialPlanDataSendTaskInfoFromJson(SomebodyOfficialPlanDataSendTaskInfo data, Map<String, dynamic> json) {
	if (json['type'] != null) {
		data.type = json['type']?.toInt();
	}
	if (json['id'] != null) {
		data.id = json['id']?.toInt();
	}
	if (json['data'] != null) {
		data.data = json['data']?.toString();
	}
//	if (json['controller'] != null) {
//		data.controller = new VideoPlayerController().fromJson(json['controller']);
//	}
	return data;
}

Map<String, dynamic> somebodyOfficialPlanDataSendTaskInfoToJson(SomebodyOfficialPlanDataSendTaskInfo entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['type'] = entity.type;
	data['id'] = entity.id;
	data['data'] = entity.data;
//	if (entity.controller != null) {
//		data['controller'] = entity.controller.toJson();
//	}
	return data;
}